errorList = []
defineNamespace = (name)->
    exports = {}
    exports.defineError = (code, defaultMessage)->
        errorList.push code: name + "." + code, defaultMessage: defaultMessage
    return exports

NS = defineNamespace 'SendSecurityCode'
NS.defineError 'IPLimit', '您使用的IP请求过于频繁，受到限制'
NS.defineError 'Frequently', '发送过于频繁，请稍后再试'

NS = defineNamespace 'SignUp'
NS.defineError 'Empty', '请求为空'
NS.defineError 'BadAccountType', '账户类型无效'
NS.defineError 'AccountRequired', '账户为空'
NS.defineError 'BadPassword', '密码格式有误'
NS.defineError 'CodeNotMatch', '验证码不匹配'
NS.defineError 'CodeExpired', '验证码已过期，请重新验证'
NS.defineError 'EmailUsed', '邮箱已被占用'
NS.defineError 'PhoneUsed', '手机号已被占用'
NS.defineError 'NicknameUsed', '昵称已被占用'

list = {}
for error in errorList
    list[error.code] = error
    error.TYPE = "AppError"

APP.Errors = list